<template>
  <a-menu
      :open-keys.sync="openKeys"
      mode="inline"
      @click="handleClick"
    theme="dark"
    style="height: 609px"
  >
    <a-sub-menu key="sub1">
      <span slot="title"><a-icon type="mail" /><span>仪表盘</span></span>
      <a-menu-item :key="'/backstage/test1'">
        <router-link :to="{ path: 'test1' }">示例1</router-link>
      </a-menu-item>
    </a-sub-menu>
    <template v-for="(item,index) of $store.state.userRouters">
      <MenuItem :key="index" :item="item" />
    </template>
    <!-- <a-sub-menu key="sub2">
      <span slot="title"><a-icon type="appstore" /><span>列表页</span></span>
      <a-menu-item :key="'/backstage/studentofclass'">
        <router-link :to="{ path: 'studentofclass' }">学生列表</router-link>
      </a-menu-item>
      <a-menu-item :key="'/backstage/teacherofclass'">
        <router-link :to="{ path: 'teacherofclass' }">科任老师</router-link>
      </a-menu-item>
      <a-menu-item :key="'/backstage/studentsofcurr'">
        <router-link :to="{ path: 'studentsofcurr' }">教学列表</router-link>
      </a-menu-item>
      <a-menu-item :key="'/backstage/assistantofclass'">
        <router-link :to="{ path: 'assistantofclass' }">成绩录入</router-link>
      </a-menu-item>
      <a-menu-item :key="'/backstage/teachersManage'">
        <router-link :to="{ path: 'teachersManage' }">教师管理</router-link>
      </a-menu-item>
      <a-menu-item :key="'/backstage/ClassManage'">
        <router-link :to="{ path: 'ClassManage' }">班级管理</router-link>
      </a-menu-item>
      <a-menu-item :key="'/backstage/ClassCurrManage'">
        <router-link :to="{ path: 'ClassCurrManage' }">课程关系</router-link>
      </a-menu-item>
      <a-menu-item :key="'/backstage/StudentsManage'">
        <router-link :to="{ path: 'StudentsManage' }">学生管理</router-link>
      </a-menu-item>
      <a-menu-item :key="'/backstage/CurriculumManage'">
        <router-link :to="{ path: 'CurriculumManage' }">课程管理</router-link>
      </a-menu-item>
    </a-sub-menu>
    <a-sub-menu key="sub3">
      <span slot="title"><a-icon type="appstore" /><span>详情页</span></span>
      <a-menu-item :key="'/backstage/datalist'">
        <router-link :to="{ path: 'datalist' }"> 基础详情页 </router-link>
      </a-menu-item>
      <a-menu-item key="8"> 示例6 </a-menu-item>
      <a-menu-item :key="'/backstage/403'">
        <router-link :to="{ path: '403' }"> 403 </router-link>
      </a-menu-item> -->
    </a-sub-menu>
  </a-menu>
</template>

<script>
import MenuItem from "../components/MenuItem.vue";
export default {
  name: "Aside",
  components: {
    MenuItem,
  },
  data() {
    return {
      current: ["mail"],
      openKeys: ["sub1"],
    };
  },
  watch: {
    openKeys(val) {
      console.log("openKeys", val);
    },
  },
  methods: {
    handleClick(e) {
      console.log("click", e);
    },
    titleClick(e) {
      console.log("titleClick", e);
    },
  },
};
</script>
<style>
</style>